package com.ysd.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ysd.entity.Books;
import com.ysd.mapper.BooksMapper;
import com.ysd.mapper.BooksxqMapper;
import com.ysd.service.BooksService;

@Service
public class BooksServiceImpl implements BooksService {

	@Autowired
	private BooksMapper booksMapper;

	@Override
	public List<Books> selectAllBooks(int page, int size) {
		return booksMapper.getAllBooks(page, size);
	}

	@Override
	public List<Books> selectBooksByWhere(Books books) {
		return booksMapper.getBooksByWhere(books);
	}

	@Override
	public List<Books> selectBooksByWhereCategory() {
		return booksMapper.getBooksByWhereCategory();
	}

	@Override
	public List<Books> selectBooksByWhereBrand() {
		return booksMapper.getBooksByWhereBrand();
	}

	@Override
	public List<Books> findBooksByPage(Books books) {
		return booksMapper.getBooksByPage(books);
	}

	@Override
	public int findCount(Books books) {
		return booksMapper.getCount(books);
	}

	@Override
	public int findBooks(Books books) {
		return booksMapper.updateBooks(books);
	}

	@Override
	public int findBooksById(int id) {
		return booksMapper.deleteBooksById(id);
	}

	@Override
	public int insertBook(Books books) {
		return booksMapper.addBook(books);
	}

	@Autowired
	private BooksxqMapper booksxqMapper;

	@Override
	public Books findBooks(Integer id) {
		// TODO Auto-generated method stub
		return booksxqMapper.getBooks(id);
	}

	@Override
	public int findCanUse(Books books) {
		// TODO Auto-generated method stub
		return booksMapper.updateCanUse(books);
	}

}
